package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TCompanyMapper;
import com.ruoyi.system.domain.TCompany;
import com.ruoyi.system.service.ITCompanyService;
import com.ruoyi.common.core.text.Convert;

/**
 * 机构Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-26
 */
@Service
public class TCompanyServiceImpl implements ITCompanyService 
{
    @Autowired
    private TCompanyMapper tCompanyMapper;

    /**
     * 查询机构
     * 
     * @param id 机构主键
     * @return 机构
     */
    @Override
    public TCompany selectTCompanyById(Long id)
    {
        return tCompanyMapper.selectTCompanyById(id);
    }

    /**
     * 查询机构列表
     * 
     * @param tCompany 机构
     * @return 机构
     */
    @Override
    public List<TCompany> selectTCompanyList(TCompany tCompany)
    {
        return tCompanyMapper.selectTCompanyList(tCompany);
    }

    /**
     * 新增机构
     * 
     * @param tCompany 机构
     * @return 结果
     */
    @Override
    public int insertTCompany(TCompany tCompany)
    {
        tCompany.setCreateTime(DateUtils.getNowDate());
        return tCompanyMapper.insertTCompany(tCompany);
    }

    /**
     * 修改机构
     * 
     * @param tCompany 机构
     * @return 结果
     */
    @Override
    public int updateTCompany(TCompany tCompany)
    {
        tCompany.setUpdateTime(DateUtils.getNowDate());
        return tCompanyMapper.updateTCompany(tCompany);
    }

    /**
     * 批量删除机构
     * 
     * @param ids 需要删除的机构主键
     * @return 结果
     */
    @Override
    public int deleteTCompanyByIds(String ids)
    {
        return tCompanyMapper.deleteTCompanyByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除机构信息
     * 
     * @param id 机构主键
     * @return 结果
     */
    @Override
    public int deleteTCompanyById(Long id)
    {
        return tCompanyMapper.deleteTCompanyById(id);
    }
}
